<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="Hexo Theme Keep">
    <meta name="description" content="Hexo Theme Keep">
    <meta name="author" content="jianyu">
    
    <title>
        
            Minidump的使用技巧 |
        
        gyu&#39;s 时光
    </title>
    
<link rel="stylesheet" href="/css/style.css">

    <link rel="shortcut icon" href="/images/logo.svg">
    
<link rel="stylesheet" href="/css/font-awesome.min.css">

    <script id="hexo-configurations">
    let KEEP = window.KEEP || {};
    KEEP.hexo_config = {"hostname":"gyu.gitee.io","root":"/","language":"zh-CN","path":"search.xml"};
    KEEP.theme_config = {"toc":{"enable":true,"number":true,"expand_all":true,"init_open":true},"style":{"primary_color":"#0066CC","avatar":"https://cdn.jsdelivr.net/gh/XPoet/image-hosting@master/common-use/avatar.jpg","favicon":"/images/logo.svg","article_img_align":"left","left_side_width":"260px","content_max_width":"920px","hover":{"shadow":true,"scale":false},"first_screen":{"enable":true,"background_img":"/images/bg.svg","description":"只要开始，一切都来得及."},"scroll":{"progress_bar":{"enable":true},"percent":{"enable":true}}},"local_search":{"enable":true,"preload":true},"code_copy":{"enable":true,"style":"default"},"pjax":{"enable":false},"lazyload":{"enable":false},"version":"3.4.2"};
    KEEP.language_ago = {"second":"%s 秒前","minute":"%s 分钟前","hour":"%s 小时前","day":"%s 天前","week":"%s 周前","month":"%s 月前","year":"%s 年前"};
  </script>
<meta name="generator" content="Hexo 5.4.0"></head>


<body>
<div class="progress-bar-container">
    
        <span class="scroll-progress-bar"></span>
    

    
</div>


<main class="page-container">

    

    <div class="page-main-content">

        <div class="page-main-content-top">
            <header class="header-wrapper">

    <div class="header-content">
        <div class="left">
            <a class="logo-title" href="/">
                gyu&#39;s 时光
            </a>
        </div>

        <div class="right">
            <div class="pc">
                <ul class="menu-list">
                    
                        <li class="menu-item">
                            <a class=""
                               href="/"
                            >
                                首页
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/archives"
                            >
                                归档
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/categories"
                            >
                                分类
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/tags"
                            >
                                标签
                            </a>
                        </li>
                    
                    
                        <li class="menu-item search search-popup-trigger">
                            <i class="fas fa-search"></i>
                        </li>
                    
                </ul>
            </div>
            <div class="mobile">
                
                    <div class="icon-item search search-popup-trigger"><i class="fas fa-search"></i></div>
                
                <div class="icon-item menu-bar">
                    <div class="menu-bar-middle"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="header-drawer">
        <ul class="drawer-menu-list">
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/">首页</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/archives">归档</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/categories">分类</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/tags">标签</a>
                </li>
            
        </ul>
    </div>

    <div class="window-mask"></div>

</header>


        </div>

        <div class="page-main-content-middle">

            <div class="main-content">

                
                    <div class="fade-in-down-animation">
    <div class="article-content-container">

        <div class="article-title">
            <span class="title-hover-animation">Minidump的使用技巧</span>
        </div>

        
            <div class="article-header">
                <div class="avatar">
                    <img src="https://cdn.jsdelivr.net/gh/XPoet/image-hosting@master/common-use/avatar.jpg">
                </div>
                <div class="info">
                    <div class="author">
                        <span class="name">jianyu</span>
                        
                            <span class="author-label">Engineer</span>
                        
                    </div>
                    <div class="meta-info">
                        <div class="article-meta-info">
    <span class="article-date article-meta-item">
        <i class="fas fa-edit"></i>&nbsp;2021-04-05 10:20:22
    </span>
    
        <span class="article-categories article-meta-item">
            <i class="fas fa-folder"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/categories/Android/">Android</a>&nbsp;
                    </li>
                
                    <li>
                        &gt; <a href="/categories/Android/debug/">debug</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    
    
        <span class="article-tags article-meta-item">
            <i class="fas fa-tags"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/tags/debug/">debug</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    

    
    
    
    
</div>

                    </div>
                </div>
            </div>
        

        <div class="article-content markdown-body">
            <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">1. Build symbols (symbols will put into &quot;objdir-gecko&#x2F;dist&#x2F;crashreporter-symbols&#x2F;&quot;):</span><br><span class="line">在项目根目录下执行:</span><br><span class="line"></span><br><span class="line">$ . setup.sh &amp;&amp; make buildsymbols</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">2.获取minidump的原始文件:&#x2F;data&#x2F;b2g&#x2F;mozilla&#x2F;CrashReports&#x2F;pending&#x2F;</span><br><span class="line"></span><br><span class="line">(dumpfile (xxx.dmp) and extra file will save under “&#x2F;data&#x2F;b2g&#x2F;mozilla&#x2F;Crash</span><br><span class="line">Reports&#x2F;pending&#x2F;” if you didn&#39;t send them to server)</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">3.使用(minidump_stackwalk)解析转储原始文件为可读的dump_result.txt</span><br><span class="line"></span><br><span class="line">有两种方式获取minidump_stackwalk工具:</span><br><span class="line">3.1</span><br><span class="line">方法一:</span><br><span class="line">minidump_stackwalk 下载路径:http:&#x2F;&#x2F;hg.mozilla.org&#x2F;build&#x2F;tools&#x2F;file&#x2F;tip&#x2F;breakpad&#x2F;</span><br><span class="line">3.2</span><br><span class="line">方法二:</span><br><span class="line">使用Google Breakpad</span><br><span class="line">eg:</span><br><span class="line">3.2.1:</span><br><span class="line">下载Google Breakpad源码</span><br><span class="line">git clone https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;breakpad</span><br><span class="line"></span><br><span class="line">3.2.2:</span><br><span class="line">git clone https:&#x2F;&#x2F;chromium.googlesource.com&#x2F;linux-syscall-support</span><br><span class="line"></span><br><span class="line">(代码中很多地方引用了#include &quot;third_party&#x2F;lss&#x2F;linux_syscall_support.h&quot;这个Linux调用库，但源码中并没有给出lss目录，所以我们需要自己翻墙去下载https:&#x2F;&#x2F;chromium.googlesource.com&#x2F;linux-syscall-support&#x2F;源码，并将lss目录拷贝到third_party下，否则编译不过。)</span><br><span class="line">3.2.3:</span><br><span class="line">在源码目录下执行:</span><br><span class="line">.&#x2F;configure &amp;&amp; make</span><br><span class="line">make install</span><br></pre></td></tr></table></figure>
<p>这样在你编译Breakpad成功后，就可以使用Breakpad下的minidump_stackwalker 工具来根据 minidump 文件生成堆栈跟踪log</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">eg: &#x2F;local&#x2F;pierxxx&#x2F;projectXX$ minidump_stackwalk</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line"> 4.dmp &gt;dump_result.txt</span><br><span class="line">或者: minidump_stackwalk dumpfile(xxx.dump) objdir-gecko&#x2F;dist&#x2F;crashreporter-symbols&#x2F; &gt; dump_result.txt</span><br><span class="line">成功的dump_result.txt</span><br><span class="line">大致内容如下:</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">Operating system: Android</span><br><span class="line">                  0.0.0 Linux 4.4.83 #1 SMP PREEMPT Tue Sep 24 11:28:43 CST 2019 armv7l</span><br><span class="line">CPU: arm</span><br><span class="line">     ARMv1 ARM part(0x4100d030) features: half,thumb,fastmult,vfpv2,edsp,neon,vfpv3,tls,vfpv4,idiva,idivt</span><br><span class="line">     2 CPUs</span><br><span class="line"></span><br><span class="line">GPU: UNKNOWN</span><br><span class="line"></span><br><span class="line">Crash reason:  SIGSEGV &#x2F;0x00000000</span><br><span class="line">Crash address: 0x0</span><br><span class="line">Process uptime: not available</span><br><span class="line"></span><br><span class="line">Thread 14 (crashed)</span><br><span class="line"> 0  libmozglue.so + 0x2c82e</span><br><span class="line">     r0 &#x3D; 0x000000e5    r1 &#x3D; 0xb05ff08c    r2 &#x3D; 0x00000021    r3 &#x3D; 0x00000000</span><br><span class="line">     r4 &#x3D; 0xb05ff544    r5 &#x3D; 0x00000003    r6 &#x3D; 0xb6e7d1f8    r7 &#x3D; 0xb6e7d150</span><br><span class="line">     r8 &#x3D; 0xb4b86b31    r9 &#x3D; 0xb656cb58   r10 &#x3D; 0x00000000   r12 &#x3D; 0x00000003</span><br><span class="line">     fp &#x3D; 0xadc1d358    sp &#x3D; 0xb05ff508    lr &#x3D; 0xb6ebf82b    pc &#x3D; 0xb6ebf82e</span><br><span class="line">    Found by: given as instruction pointer in context</span><br><span class="line"> 1  libxul.so + 0x3fad65</span><br><span class="line">     sp &#x3D; 0xb05ff510    pc &#x3D; 0xb4b86d67</span><br><span class="line">    Found by: stack scanning</span><br><span class="line"> 2  libxul.so + 0x1d86ad0</span><br><span class="line">     sp &#x3D; 0xb05ff520    pc &#x3D; 0xb6512ad2</span><br><span class="line">    Found by: stack scanning</span><br><span class="line"></span><br><span class="line">Thread 0</span><br><span class="line"> 0  libc.so + 0x21888</span><br><span class="line">     r0 &#x3D; 0xae2f1e10    r1 &#x3D; 0x00000080    r2 &#x3D; 0x00000000    r3 &#x3D; 0x00000000</span><br><span class="line">     r4 &#x3D; 0xae2f1e10    r5 &#x3D; 0xae2f1e04    r6 &#x3D; 0x00000000    r7 &#x3D; 0x000000f0</span><br><span class="line">     r8 &#x3D; 0xffffffff    r9 &#x3D; 0xb6f02168   r10 &#x3D; 0x00000001   r12 &#x3D; 0x00000000</span><br><span class="line">     fp &#x3D; 0xb3829f78    sp &#x3D; 0xbe97ca48    lr &#x3D; 0xb6e42054    pc &#x3D; 0xb6e54888</span><br><span class="line">    Found by: given as instruction pointer in context</span><br><span class="line"> 1  libmozglue.so + 0x2a447</span><br><span class="line">     sp &#x3D; 0xbe97ca60    pc &#x3D; 0xb6ebd449</span><br><span class="line">    Found by: stack scanning</span><br><span class="line"> 2  libmozglue.so + 0x2a94f</span><br><span class="line">     sp &#x3D; 0xbe97ca68    pc &#x3D; 0xb6ebd951</span><br><span class="line">    Found by: stack scanning</span><br><span class="line"> 3  libnss3.so + 0x114761</span><br><span class="line">     sp &#x3D; 0xbe97ca88    pc &#x3D; 0xb46eb763</span><br><span class="line">    Found by: stack </span><br><span class="line">    -------------------------------</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">3.2.4:</span><br><span class="line">addr2line</span><br><span class="line">然后就可以使用addr2line 进行符号解析.从而追溯到对应该的堆栈信息.</span><br><span class="line">(符号解析，可以使用 ndk 中提供的addr2line来根据地址进行一个符号反解的过程)</span><br><span class="line">eg:</span><br><span class="line">arm-linux-androideabi-addr2line -f -C -e (对于的.so库文件)  (符号地址)</span><br></pre></td></tr></table></figure>
<ul>
<li>更多Google Breakpad学习参考：<a class="link"   target="_blank" rel="noopener" href="https://www.jianshu.com/p/295ebf42b05b" >https://www.jianshu.com/p/295ebf42b05b<i class="fas fa-external-link-alt"></i></a></li>
</ul>

        </div>

        
            <div class="post-copyright-info">
                <div class="article-copyright-info-container">
    <ul>
        <li>
            版权声明：本博客所有文章除特别声明外，均采用 <a class="license" target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">BY-NC-SA</a> 许可协议。转载请注明出处！
        </li>
    </ul>
</div>

            </div>
        

        
            <div class="article-nav">
                
                    <div class="article-prev">
                        <a class="prev"
                           rel="prev"
                           href="/2021/05/05/Kaios_usb%20Mode/"
                        >
                            <span class="left arrow-icon flex-center">
                              <i class="fas fa-chevron-left"></i>
                            </span>
                            <span class="title flex-center">
                                <span class="post-nav-title-item">Kaios:分析usb Mode切换,状态变化的底层逻辑</span>
                                <span class="post-nav-item">上一篇</span>
                            </span>
                        </a>
                    </div>
                
                
                    <div class="article-next">
                        <a class="next"
                           rel="next"
                           href="/2021/02/05/Android%20Binder%E6%9C%BA%E5%88%B6%E5%8E%9F%E7%90%86/"
                        >
                            <span class="title flex-center">
                                <span class="post-nav-title-item">Android Binder机制原理</span>
                                <span class="post-nav-item">下一篇</span>
                            </span>
                            <span class="right arrow-icon flex-center">
                              <i class="fas fa-chevron-right"></i>
                            </span>
                        </a>
                    </div>
                
            </div>
        

        
    </div>
</div>


                
            </div>

        </div>

        <div class="page-main-content-bottom">
            <footer class="footer">
    <div class="info-container">
        <div class="copyright-info info-item">
            &copy;
            
              <span>2018</span>&nbsp;-&nbsp;
            
            2021&nbsp;<i class="fas fa-heart icon-animate"></i>&nbsp;<a href="/">jianyu</a>
        </div>
        
        
    </div>
</footer>

        </div>
    </div>

    
        <div class="post-tools">
            <div class="post-tools-container">
    <ul class="tools-list">
        <!-- TOC aside toggle -->
        
            <li class="tools-item page-aside-toggle">
                <i class="fas fa-outdent"></i>
            </li>
        

        <!-- go comment -->
        
    </ul>
</div>

        </div>
    

    <div class="right-bottom-side-tools">
        <div class="side-tools-container">
    <ul class="side-tools-list">
        <li class="tools-item tool-font-adjust-plus flex-center">
            <i class="fas fa-search-plus"></i>
        </li>

        <li class="tools-item tool-font-adjust-minus flex-center">
            <i class="fas fa-search-minus"></i>
        </li>

        <li class="tools-item tool-expand-width flex-center">
            <i class="fas fa-arrows-alt-h"></i>
        </li>

        <li class="tools-item tool-dark-light-toggle flex-center">
            <i class="fas fa-moon"></i>
        </li>

        <!-- rss -->
        

        

        <li class="tools-item tool-scroll-to-bottom flex-center">
            <i class="fas fa-arrow-down"></i>
        </li>
    </ul>

    <ul class="exposed-tools-list">
        <li class="tools-item tool-toggle-show flex-center">
            <i class="fas fa-cog fa-spin"></i>
        </li>
        
            <li class="tools-item tool-scroll-to-top flex-center">
                <i class="arrow-up fas fa-arrow-up"></i>
                <span class="percent"></span>
            </li>
        
    </ul>
</div>

    </div>

    
        <aside class="page-aside">
            <div class="post-toc-wrap">
    <div class="post-toc">
        
    </div>
</div>
        </aside>
    

    <div class="image-viewer-container">
    <img src="">
</div>


    
        <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
          <span class="search-input-field-pre">
            <i class="fas fa-keyboard"></i>
          </span>
            <div class="search-input-container">
                <input autocomplete="off"
                       autocorrect="off"
                       autocapitalize="off"
                       placeholder="搜索..."
                       spellcheck="false"
                       type="search"
                       class="search-input"
                >
            </div>
            <span class="popup-btn-close">
                <i class="fas fa-times"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fas fa-spinner fa-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>

    

</main>




<script src="/js/utils.js"></script>

<script src="/js/main.js"></script>

<script src="/js/header-shrink.js"></script>

<script src="/js/back2top.js"></script>

<script src="/js/dark-light-toggle.js"></script>



    
<script src="/js/local-search.js"></script>




    
<script src="/js/code-copy.js"></script>





<div class="post-scripts">
    
        
<script src="/js/left-side-toggle.js"></script>

<script src="/js/libs/anime.min.js"></script>

<script src="/js/toc.js"></script>

    
</div>



</body>
</html>
